// Copyright (c) Razanii 2022
// License: GNU LGPLv3. More info in root project directory file 'LICENSE'

#include "data.hpp"



bool convertum::data::check_type(const std::string& TYPE) {
    if (TYPE.size() < 1 && TYPE.size() > 3)
        return false;

	 static const std::regex patterns[3] = {
		  std::regex("[kmgtpe][bB]"),
		  std::regex("[KMGTPE]i?[bB]"),
		  std::regex("[bB]")
	 };

	 for (const auto& pattern : patterns) {
		  if (std::regex_match(TYPE, pattern))
				return true;
	 }

    return false;
}

